<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta http-equiv="Content-Type">
		<meta content="text/html; charset=utf-8">
		<meta charset="utf-8">
		<title>今日话题</title>
		<meta name="description" content="{$_C['site_des']}">
		<meta name="keywords" content="{$_C['site_keyword']}">		
		<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
		<meta name="format-detection" content="telephone=no">
		<meta name="format-detection" content="email=no">        
		
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/load.css" /> 
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/index.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/animations.css" />
	</head>       
      
	<body>
		<div id="content" class="hudong">
			<form class="jp-wrap">
			<div class="page page-1-1 page-current">
				<div class="wrap">
					<a href="index.html" class="backToIndex"><img src="{$_C.hy_path}images/p3_return.png" class=" page-moveCircle"></a>
 					<div class="textarea page-moveScale page-delay300">
 						<b>{$vote.name|default:"该话题已过期或不存在"}</b>
 						<img src="{$_C.hy_path}images/p2_textarea.png" class="page-moveScale textarea_bg">
 					</div>
					{if $vote}
 					<div class="choice page-moveScale page-delay300" style="margin-bottom:20px">
 						<p>请选择：</p>
 						<ul>
 							{foreach from=$vote.option item=option key=key }
							
 							<li>
 								{if $key ==0}
								A.
								{elseif $key ==1}
								B.
								{elseif $key ==2}
								C.
								{elseif $key ==3}
								D.
								{elseif $key ==4}
								E.
								{elseif $key ==5}
								F.
								{elseif $key ==6}
								G.
								{/if}
								{$option.name}<input value="{$option.id}"   type="radio" name="danxuan" id="c{$key}" /><label class="white_block" for="c{$key}"></label></li>
 							{/foreach}
 						</ul>
 						<img src="{$_C.hy_path}images/p3_choose.png" class="page-moveFromBottomFade choose_bg">
 					</div>
 					<div class="submit_wrapper">
 						<input  value="{$vote.id}" name="vid" type="hidden">
 						<img   data-type="yes" class="btn submit yf-post page-moveFromBottomFade page-delay1200" src="{$_C.hy_path}images/p3_btn.png" />
 					</div>
					{/if}
					
 					<p class="foot">本页面由广州电视台G4提供</p>
				</div>
			</div>
			</form>
    	</div>	
		
	
<div class="alert" id="alert2" style="padding:15px">
		
			<div id="msg" class="fs3"></div>
			
			
			<a href="javascript:void(0)" class="alert-btn fc1 fs3">确定</a>
			
		</div>
		
        <script type="text/javascript" src="{$_C.hy_path}js/zepto.min.js"></script>
		<script type="text/javascript" src="{$_C.hy_path}js/main.js"></script>
		<script src="{$_C.hy_path}js/yf.js"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<script>
			
				function showMsg(msg)
			{
					$("#msg").text(msg);
					$('div#alert2').show();
			}
			$(function(){
				
				$('a.alert-btn').click(function (e) {
					$('div.alert').hide();
					});
					
				$('.yf-post').click(function(){
					
					
					var _this = $(this);
					var type = _this.attr('data-type');
					if(type == 'done')
					{
						showMsg("您已成功提交");
					}
					else if(type == 'yes')
					{
						var data = {};
						var data_arr = $('form').serialize().replace(/\+/g,' ').split('&');
						for(var i=0;i<data_arr.length;i++)
						{
							var temp=data_arr[i].split('=');
							if(typeof(data[hungry.util.utf8_decode(temp[0])])!='undefined')
							{
								var arr=[];
								if(data[hungry.util.utf8_decode(temp[0])] instanceof Array)
								{
									arr=data[hungry.util.utf8_decode(temp[0])];
								}
								else
								{
									arr.push(data[hungry.util.utf8_decode(temp[0])]);
								}
									arr.push(hungry.util.utf8_decode(temp[1]));
									data[hungry.util.utf8_decode(temp[0])]=arr;
							}
							else
							{
								data[hungry.util.utf8_decode(temp[0])]=hungry.util.utf8_decode(temp[1]);
							}
						}
						_this.attr('data-type', 'no');
						_this.text('提交中');
						$.post('index.php?g=mobile&m=vote&a=send_vote',data,function(result){
							if(result.error == 0)
							{
								showMsg(result.content);
								//location.reload();
								_this.attr('data-type', 'done');
							}
							else
							{
								
								showMsg(result.content);
								_this.attr('data-type', 'yes');
								_this.text('提交');
							}
						},'json');
					}
					else
					{
						showMsg("数据提交中");
					}
				});
			});
			
				
				wx.config({
				debug: false,
				appId: '{$jsdk.appId}',
				timestamp: {$jsdk.timestamp},
				nonceStr: '{$jsdk.nonceStr}',
				signature: '{$jsdk.signature}',
				jsApiList: [
			
					 'onMenuShareTimeline',
		      'onMenuShareAppMessage'
				]
			});
			
			var images = {
				    localId: [],
				    serverId: []
				  };
			
			wx.ready(function(){
				
				
				
				
				 wx.onMenuShareTimeline({
    
    title: '今日话题',
   
  imgUrl: 'http://yf.lly360.com/Mobile/Webroot/gf/images/share-vote.png',
  
      trigger: function (res) {
       
      },
      success: function (res) {
       			
			
      },
      cancel: function (res) {
       
      },
      fail: function (res) {
        alert(JSON.stringify(res));
      }
    });
    
	wx.onMenuShareAppMessage({
   // link:'http://wxyx.weidianit.com/index.php?g=home&m=shake&a=index&pid='+pid,
     title: '今日话题',
    desc: '今日话题，热点讨论！',
  imgUrl: 'http://yf.lly360.com/Mobile/Webroot/gf/images/share-vote.png',
    success: function () { 
	
			
				
    },
    cancel: function () { 
        // 用户取消分享后执行的回调函数
    }
});
				
				});
				
		</script>
	</body>
</html>
